home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2001 September / PC-WELT 9-2001.ISO / software / hw / brennen / flask_src.exe / Input / IFOParser / print_ifo_pgci.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-07  |  3.7 KB  |  171 lines

  1.  
  2. /*
  3.  * PGROGRAM CHAIN INFORMATION
  4.  *
  5.  * Copyright (C) 1998,1999  Thomas Mirlacher
  6.  *
  7.  * This program is free software; you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License as published by
  9.  * the Free Software Foundation; either version 2 of the License, or
  10.  * (at your option) any later version.
  11.  * 
  12.  * This program is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  * GNU General Public License for more details.
  16.  * 
  17.  * You should have received a copy of the GNU General Public License
  18.  * along with this program; if not, write to the Free Software
  19.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  * 
  21.  * The author may be reached as dent@cosy.sbg.ac.at, or
  22.  * Thomas Mirlacher, Jakob-Haringerstr. 2, A-5020 Salzburg,
  23.  * Austria
  24.  *
  25.  *------------------------------------------------------------
  26.  *
  27.  */
  28.  
  29.  
  30. #include "IFOparser.h"
  31. extern CIFOParser *IFOGlobal;
  32. #include <malloc.h>
  33.  
  34. #include <stdio.h>
  35.  
  36.  
  37. #include <sys/types.h>
  38. //#include <unistd.h>
  39. #include "ifo.h"
  40.  
  41. #include "misc.h"
  42. #include "decode.h"
  43.  
  44. #define PGCI_SUB_LEN 8
  45.  
  46. typedef struct {
  47.     u_short id        : 16;    // Language
  48.     u_short            : 16;    // don't know
  49.     u_int    start        : 32;    // Start of unit
  50. } pgci_sub_t;
  51.  
  52.  
  53. #define MLU_SUB_LEN 8
  54.  
  55. typedef struct {
  56.         u_short lang            : 16;   // Language
  57.         u_short foo             : 16;   // don't know
  58.         u_int   start           : 32;   // Start of unit
  59. } mlu_sub_t;
  60.  
  61. #define LU_SUB_LEN 8
  62.  
  63. typedef struct {
  64.     u_char    menu_id        : 4;    // 0=off, 3=root, 4=spu,
  65.                     // 5=audio, 6=angle, 7=ptt
  66.         u_short foo1        : 4;    // don't know
  67.         u_short foo2        : 8;    // don't know
  68.         u_short bar        : 16;    // don't know
  69.         u_int   start           : 32;    // Start of unit
  70. } lu_sub_t;
  71.  
  72. static void _ifoPrint_mlu (u_char *ptr);
  73.  
  74. /**
  75.  *
  76.  */
  77.  
  78. void ifoPrint_title_pgci (ifo_t *ifo)
  79. {
  80.     ifo_hdr_t *hdr = (ifo_hdr_t *) ifo->data[ID_TITLE_PGCI];
  81.     int i;
  82.  
  83.     if (!hdr)
  84.         return;
  85.  
  86.     printf ("\nTITLE PROGAM CHAIN INFORMATION\n");
  87.     printf ("---\n");
  88.     printf ("number of units: %d\n", bswap_16 (hdr->num));
  89.  
  90.         
  91.     if(bswap_16 (hdr->num)<=0)
  92.     {
  93.         IFOGlobal->fatal_error_flag = 1;
  94.         return;
  95.     }
  96.     IFOGlobal->pgcs.SetArraySize( bswap_16 (hdr->num) );
  97.     
  98.     for (i=0; i<bswap_16(hdr->num); i++) {
  99.         char *ptr;
  100.         IFOGlobal->PGCptr = i;
  101.         if (ifoGetPGCI (hdr, i, &ptr) >= 0)
  102.             ifoPrint_pgc ((unsigned char *)ptr);
  103.     }
  104. }    
  105.  
  106.  
  107. /**
  108.  *
  109.  */
  110.  
  111. void ifoPrint_menu_pgci (ifo_t *ifo)
  112. {
  113.     ifo_hdr_t *hdr = (ifo_hdr_t *) ifo->data[ID_MENU_PGCI];
  114.     int i;
  115.  
  116.     if (!hdr)
  117.         return;
  118.  
  119.     printf ("\nMENU PROGRAM CHAIN INFORMATION\n");
  120.     printf ("---\n");
  121.     printf ("number of units: %x\n", bswap_16 (hdr->num));    
  122.  
  123.     for (i=0; i<bswap_16(hdr->num); i++) {
  124.         char *ptr;
  125.  
  126.         if (ifoGetPGCI (hdr, i, &ptr) >= 0)
  127.             _ifoPrint_mlu ((unsigned char *)ptr);
  128.     }
  129. }    
  130.  
  131.  
  132. /**
  133.  *
  134.  */
  135.  
  136. static void _ifoPrint_mlu (u_char *ptr)
  137. {
  138.     ifo_hdr_t *hdr = (ifo_hdr_t *) ptr;
  139.     int i;
  140.  
  141.     printf ("\n\tLANGUAGE UNIT\n");
  142.  
  143.     ptr += IFO_HDR_LEN;
  144.  
  145.     for (i=1; i<=bswap_16(hdr->num); i++) {
  146.         lu_sub_t *lu_sub = (lu_sub_t *) ptr;
  147.  
  148.         if (lu_sub->foo1) {
  149.             printf ("\t\t%x: menu_id: %s\tmenu: %x parental: %x\n",
  150.                 i,
  151.                 decode_menuname (lu_sub->menu_id),
  152.                 lu_sub->foo2,
  153.                             bswap_16 (lu_sub->bar));
  154.         } else {
  155.             printf ("\t\t%x:\t\t\t\tmenu: %x parental: %x\n",
  156.                 i,
  157.                 lu_sub->foo2,
  158.                             bswap_16 (lu_sub->bar));
  159.         }
  160.  
  161.         ptr += LU_SUB_LEN;
  162.     }
  163.  
  164.     for (i=0; i<bswap_16(hdr->num); i++) {
  165.         char *ptr;
  166.  
  167.         if (ifoGetPGCI (hdr, i, &ptr) >= 0)
  168.             ifoPrint_pgc ((unsigned char *)ptr);
  169.     }
  170. }
  171.